package org.kota5.shapeandroid.palette;

 /*
 * ShapeChildren.java
 *
 * Created on September 21, 2006, 9:10 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 *
 * To understand this class, see http://platform.netbeans.org/tutorials/nbm-nodesapi3.html
 */




import java.util.ArrayList;
import org.openide.nodes.Index;
import org.openide.nodes.Node;

/**
 *
 * @author Geertjan Wielenga
 */
public class ShapeChildren  extends Index.ArrayChildren {

    private Category category;

    private String[][] items = new String[][]{
        {"0", "Widget", "org/kota5/shapeandroid/palette/btn_default_normal.9.png"},
        {"1", "Widget", "org/kota5/shapeandroid/palette/spinner_normal.9.png"},
        {"2", "Widget", "org/kota5/shapeandroid/palette/textfield_default.9.png"},
    };

    public ShapeChildren(Category Category) {
        this.category = Category;
    }

    protected java.util.List initCollection() {
        ArrayList childrenNodes = new ArrayList( items.length );
        for( int i=0; i<items.length; i++ ) {
            if( category.getName().equals( items[i][1] ) ) {
                Shape item = new Shape();
                item.setNumber(new Integer(items[i][0]));
                item.setCategory(items[i][1]);
                item.setImage(items[i][2]);
                childrenNodes.add( new ShapeNode( item ) );
            }
        }
        return childrenNodes;
    }

}